<template>
  <div class="box">
    <!-- 服务管理 -->
    <div class="innerPageTable-box-OneTwo value-set-list-wrap innerPageTable-out-flex">
      <!-- 搜索区域 -->
      <SelfAdaption>
        <Form
          :model="searchForm"
          ref="serviceForm"
          slot="adaption-bar"
          label-position="top"
          class="ivu-form-no-margin-bottom"
          inline
        >
          <Form-item prop="vsCode" :label="'报表名称'">
            <Input
              type="text"
              v-model.trim="searchForm.serviceName"
              :placeholder="'请输入'"
              @on-enter="searchValueSet"
            ></Input>
          </Form-item>

          <!-- 查询\重置按钮 -->
          <Form-item prop="button" class="search-solt-btn">
            <RPButton optType="search" @click="searchValueSet()" />
          </Form-item>
        </Form>
      </SelfAdaption>
      <InnerPageTable ref="valueSetTable" :config="pageTableConfig"> </InnerPageTable>
    </div>
  </div>
</template>

<script>
import listPage from './list.vue'
import statistic from './statistic.vue'
import { tableColumns } from './columns'
import permission from '@/mixin/permission'
export default {
  name: 'dataElementsList',
  mixins: [permission],
  data() {
    return {
      searchForm: {
        serviceName: ''
      },
      pageTableConfig: {
        loadDataFn: this.getServiceList,
        columns: tableColumns.bind(this)(),
        autoFirst: false //默认 就是 false, 要配置在这里
      }
    }
  },
  methods: {
    getServiceList(tableObj) {
      let { responseProcess, param } = tableObj
      let list = []
      list.push({ name: '2024年客户数据调查表', id: 1, type: 1 })
      let records = list.filter(item => item.name.includes(this.searchForm.serviceName))
      responseProcess({
        pageNum: 1,
        pageSize: 10,
        pages: 1,
        records
      })
    },
    searchValueSet() {
      this.$refs['valueSetTable'].load(this.searchForm)
    },
    // 操作
    codeTest() {
      new this.$sidelipPage(listPage, {
        props: { $route: this.$route }
      })
    },
    managementFun() {
      new this.$sidelipPage(listPage, {
        props: {
          isView: true
        }
      })
    },
    statisticsFun() {
      new this.$sidelipPage(statistic, {
        props: { $route: this.$route }
      })
    }
  },
  created() {
    this.$store.dispatch('getBuUnit')
    this.$store.dispatch('getUserBuByDataEle')
  },
  mounted() {
    this.searchValueSet()
  }
}
</script>

<style lang="less" scoped>
.box {
  display: flex;
  flex-direction: column;
  .tabs-app {
    flex: 1;
    display: flex;
    flex-direction: column;
    /deep/.ivu-tabs-content {
      flex: 1;
    }
  }
}
.title {
  font-size: 18px;
  font-weight: bold;
  padding: 14px;
}
</style>
